/**
 * 
 */
package state;

/**
 * PatternBox: "Context" implementation.
 * <ul>
 *   <li>defines the interface of interest to clients.</li>
 *   <li>maintains an instance of a ConcreteState subclass that defines the current state.</li>
 * </ul>
 * 
 * @author <a href="mailto:dirk.ehms@patternbox.com">Dirk Ehms</a>
 * @author lx
 */
public class Account {

	/** stores the associated State instance */
	private State fState;

	/** 
	 * Constructor
	 */
	public Account(State state) {
		super();
		fState = state;
	}

	/** 
	 * The Context object delegates all state-specific requests to its
	 * associated State instance.
	 */
	public void request() {
		// TODO: Customize this method based on your application needs.
		fState.handle(this);
	}

	/** 
	 * This method changes the state of the Context instance.
	 */
	public void changeState(State state) {
		fState = state;
	}
public static void main(String[] args) {
	Account client=new Account(new OpenState());
//	client.request();
	
	//.........
	client.changeState(new LockState());
//	client.request();
	
	client.changeState(new ClosedState());
	client.request();
}
}
